
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
How the synchronization works</TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="apptechp74.htm">Previous</A>&nbsp;&nbsp;<A HREF="apptechp76.htm" >Next</A>
<!-- End Header -->
<A NAME="TI1885"></A><h1>How the synchronization works</h1>
<A NAME="TI1886"></A><h4>How MLSync events are implemented</h4>
<A NAME="TI1887"></A><p>The MLSync object in a PowerBuilder application and the <b>dbmlsync</b> process communicate
with each other by sending messages between two windows, as shown
in <A HREF="apptechp75.htm#CIHJAEJH">Figure 13-2</A>. The
window that the MLSync object creates uses an internal function,
MlSyncControlWindowProc, to process these messages. </p>
<A NAME="TI1888"></A><p>The <b>Synchronize</b> function adds a "-wh
 window_handle" argument to the end of the command
line string that launches <b>dbmlsync</b>. This lets <b>dbmlsync</b> send WM_COPYDATA
messages to this window handle. MlSyncControlWindowProc then triggers
the appropriate event in the MLSync object.</p>
<A NAME="CIHJAEJH"></A><caption><b>Figure 13-2: How the synchronization process
works</b></captionls>
<br><img src="images/mlscheme.gif">
<A NAME="TI1889"></A><h4>How progress window events are triggered</h4>
<A NAME="TI1890"></A><p>The MobiLink Synchronization Wizard generates an instance
of an MLSync object that contains PowerScript code in each of its
events. When appropriate, this code triggers an event of the same
name in the progress window that is either generated by the wizard
or customized for your applications.</p>
<A NAME="TI1891"></A><h4>How the CancelSync function is implemented</h4>
<A NAME="TI1892"></A><p>On the <b>dbmlsync</b> command string, there is
a "-wc window_class" argument that specifies
the class name of a communications window that <b>dbmlsync</b> registers and
creates. If the PowerBuilder application needs to cancel the synchronization
process during any of its event processing logic, it calls <b>CancelSync</b>.
This function finds the window handle associated with the -wc window
class and sends a WM_CLOSE message.</p>

